package com.falm.picturebackend.config;

import javax.annotation.Resource;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.falm.picturebackend.interceptor.LoginInterceptor;

//@Configuration 告诉springboot这是一个配置类
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Resource
    LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
            .addPathPatterns("/**") // 默认对所有请求进行拦截
            .excludePathPatterns("/api/user/login", "/static/**", "/doc**", "/v3/api-docs/**", "/swagger-ui/**",
                "/api-docs/**");
    }
}